package com.gxa.financial.controller;

import com.gxa.financial.service.AccountListService;
import com.gxa.common.R;
import com.gxa.common.entity.financial_management.AccountList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/accountList")
public class AccountListController {

    @Autowired
    private AccountListService accountListService;

    //分页查询
    @GetMapping("/selectAccountList")
    public R selectAccountList(Integer currentPage, Integer pageSize){
        return accountListService.selectAccountList(currentPage,pageSize);
    }
    //条件查询
    @GetMapping("/selectAccount")
    public R selectAccount(Integer currentPage, Integer pageSize, AccountList accountList){
        return accountListService.selectAccount(currentPage,pageSize,accountList);
    }

    //冻结账户
    @PostMapping("/updateAccountFrozen")
    public R updateAccountFrozen(@RequestBody AccountList accountList){
        return accountListService.updateAccountFrozen(accountList);
    }

    //解冻账户
    @PostMapping("/updateAccountThaw")
    public R updateAccountThaw(@RequestBody AccountList accountList){
        return accountListService.updateAccountThaw(accountList);
    }

    //根据账户id查询账户
    @GetMapping("/selectAccountById")
    public R selectAccountById(String id){
        return accountListService.selectAccountById(id);
    }

    //添加账户
    @PostMapping("/addAccount")
    public R addAccount(@RequestBody AccountList accountList){
        return accountListService.addAccount(accountList);
    }

    //根据电话号码查账户
    @GetMapping("/selectAccountByPhone")
    public AccountList selectAccountByPhone(String phone){
        return accountListService.selectAccountByPhone(phone);
    }


}
